package com.czl.module_service.fragment.assetHandle

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.czl.base.base.BaseTabFragment
import com.czl.base.base.BaseTabViewModel
import com.czl.base.config.AppConstants
import com.czl.base.databinding.FragmentBaseTabBinding
import com.czl.base.event.LiveBusCenter
import com.czl.base.route.RouteCenter
import me.yokeyword.fragmentation.SupportFragment

@Route(path = AppConstants.Router.Service.F_SERVICE_ASSET_HANDLE_APPLY)
class AssetHandleApplyFragment : BaseTabFragment<FragmentBaseTabBinding, BaseTabViewModel>() {

    override fun fragments(): List<SupportFragment> {
        return arrayListOf(
            RouteCenter.navigate(AppConstants.Router.Service.F_SERVICE_ASSET_HANDLE_APPLY_ADD, Bundle().apply {

            }) as SupportFragment,

            RouteCenter.navigate(AppConstants.Router.Service.F_SERVICE_ASSET_HANDLE_MY_APPLY, Bundle().apply {

            }) as SupportFragment,

            RouteCenter.navigate(AppConstants.Router.Service.F_SERVICE_ASSET_HANDLE_APPROVAL_LIST, Bundle().apply {

            }) as SupportFragment
        )
    }

    override fun initData() {
        super.initData()
        viewModel.tabData.set("处置申请, 我的申请, 处置审批")
        viewModel.tvTitle.set("资产处置")
    }

    override fun useBaseLayout(): Boolean {
        return true
    }

    override fun initViewObservable() {
        super.initViewObservable()
        LiveBusCenter.observeGoToTabEvent(this, {
            binding.viewPager.currentItem = it.index!!
            LiveBusCenter.postAssetResultReturnEvent(0)
        })
    }
}